$(function () {

    $.get("person?mode=embedded", function (data) {
        $("#middle").html(data);
    });

    $(document).on("click", "input[type='submit']", function (event) {
        var $button = $(this);
        var target = $button.attr('data-poc-target');
        if (target) {
            event.preventDefault();
            var $form = $button.closest('form');
            var data = $form.serializeArray();
            var url = $form.prop('action');
            data.push({ name: $button.prop('name'), value: $button.prop('value') });
            $(target).load(url, data);
        }
    });

    $(document).on("click", "a.ajax", function (event) {
        var $anchor = $(this);
        var target = $anchor.attr('data-poc-target');
        if (target) {
            event.preventDefault();
            var href = $anchor.prop('href');
            $(target).load(href);
        }
    });
});